import storeManage from "../store/index";
export default {

    /**
    * 获取状态栏高度
    */
    getStatusBarHeight() {
        window.hilink && window.hilink.getStatusBarHeight(
            (res) => {
                if (this.getDeviceOs().isTablet && !this.isOrientation()) {
                    storeManage.commit("setStatusBarHeight", 12);
                } else {
                    storeManage.commit("setStatusBarHeight", JSON.parse(res).statusBarHeight || 24);
                }
            }
        );
    },
    /**
    * 获取设备模式
    */
    getDeviceMode() {
        if (storeManage.state.isIos) { //IOS
            window.hilink && window.hilink.getDarkMode('resultCallback');
            window.resultCallback = (res) => {
                console.log('getDeviceMode => ', res);
                storeManage.commit("setIsDarkMode", res === 1 ? false : true);
            }
        } else {// 安卓
            if (window.hilink) {
                let flag = window.hilink.getDarkMode() === 2;
                storeManage.commit("setIsDarkMode", flag);
            }
        }
    }
}